package com.levy.contronller.cLesson;

import org.junit.Test;

public class Fibona {

    @Test
    public void febona1() {
        int a0 = 0;
        int a1 = 1;
        int count = 10;

        for (int i = 2; i < count / 2; i++) {
            a0 = a0 + a1;
            a1 = a1 + a0;
            System.out.print(a0 + " " + a1 + " ");

            if (i % 5 == 0) {
                System.out.println();
            }
        }
    }

    @Test
    public void febona2() {
        int i = 2;
        int f0 = 0;
        int f1 = 1;
        int count = 7;

        for (; i <= count / 2; i++) {
            f0 = f0 + f1;
            f1 = f1 + f0;

            System.out.print(f0 + " " + f1 + " ");

            if (i % 5 == 0) {
                System.out.println();
            }
        }

        if (count % 2 != 0 && count > 2) {
            f1 = f0 + f1;
            System.out.println(f1);
        }


    }

    public static void main(String[] args) {

    }
}
